import argparse
import factory

parser = argparse.ArgumentParser(description='AI实验室')

parser.add_argument('config_name', type=str, help='配置名称')
parser.add_argument('--folder', type=str, default='', help='模型存储位置')

parser.add_argument('--start', type=int, default=0, help='训练起始位置（闭区间）')
parser.add_argument('--end', type=int, default=900000000, help='训练结束位置（开区间）')
parser.add_argument('--repeat', type=int, default=1, help='训练数据重复次数')


def run():
    args = parser.parse_args()
    config = factory.get(args.config_name)()
    if args.folder:
        config.folder = args.folder
    else:
        config.folder = f'data/{args.config_name}'
    Learner = factory.get(config.learner_name)
    learner = Learner(config)
    learner.train(start=args.start, end=args.end, repeat=args.repeat)


if __name__ == '__main__':
    run()
